<html>
<head>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.3&sensor=true"></script>
<script>
var myLatLng = null;
var map = null;
var myOptions = {
	zoom: window.qml.zoom,
	center: myLatLng,
	mapTypeId: eval(window.qml.mapTypeId),
	panControl: true
};
var marker = null;
var contentString = '';
var infowindow = null;

function setZoom(z) {
//	myOptions.zoom = z;
	map.setZoom(z);
}

function setMapType(type) {
	myOptions.mapTypeId = type;
}

function gotoLocation(lat, lng) {
	myLatLng = new google.maps.LatLng(lat, lng);
	myOptions.center = myLatLng;
	myOptions.zoom = window.qml.zoom;
	myOptions.mapTypeId = eval(window.qml.mapTypeId);
	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	marker = new google.maps.Marker({
		position: myLatLng,
		map: map,
		title:"My current Location here"
	});
	contentString = '<div id="content">Current Location</div>';
	infowindow = new google.maps.InfoWindow({
		content: contentString
	}); 
	google.maps.event.addListener(marker, 'click', function() {
		infowindow.open(map,marker);
	});
	google.maps.event.addListener(map, 'zoom_changed', function() {
		window.qml.zoom = map.getZoom();
	});
	google.maps.event.addListener(map, 'maptypeid_changed', function() {
		var type = map.getMapTypeId();
		if (type == 'hybrid') {
			window.qml.mapTypeId = 'google.maps.MapTypeId.HYBRID'
		} else if (type == 'roadmap') {
			window.qml.mapTypeId = 'google.maps.MapTypeId.ROADMAP'
		} else if (type == 'satellite') {
			window.qml.mapTypeId = 'google.maps.MapTypeId.SATELLITE'
		} else if (type == 'terrain') {
			window.qml.mapTypeId = 'google.maps.MapTypeId.TERRAIN'
		}
	});
}

function initialize() {
	window.qml.isInited = true;
}
</script>
</head>
<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px">
	<div id="map_canvas"  style="width: 100%; height: 100%"/>
</body>
</html>
